﻿//-----------------------------------------------------------------------
// <copyright file="SupplierValidator.cs" company="FER">
//     Copyright (c) All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace NMBP.View.Validators
{
    using Models;

    /// <summary>
    /// Supplier validator class
    /// </summary>
    public static class SupplierValidator
    {
        /// <summary>
        /// Validates suppliers properties
        /// </summary>
        /// <param name="supplier">supplier to be validated</param>
        /// <returns>value indicating whether supplier validates or not</returns>
        public static bool IsSupplierValid(Supplier supplier)
        {
            if (supplier.AccountNumber.Length != 10)
            {
                return false;
            }

            if (supplier.Contact.Length >= 20 || supplier.Contact.Length <= 5)
            {
                return false;
            }

            if (supplier.Name.Length >= 20 || supplier.Name.Length <= 5)
            {
                return false;
            }

            return true;
        }
    }
}
